<template>
  <div class="sendReminder">
    <van-form @submit="onSubmit">
      <van-field
        v-model="formInline.sendReminder"
        rows="2"
        autosize
        label="提醒内容"
        type="textarea"
        maxlength="100"
        name="sendReminder"
        placeholder="请填写对企业下发的提醒内容"
        show-word-limit
        :required="false"
      />
      <div style="margin: 0.5rem;">
        <van-button :loading="loading" round block type="info" native-type="submit">提交</van-button>
      </div>
    </van-form>
  </div>
</template>
<script>
import {
  AqAddSendReminder,
  HbAddSendReminder,
  XfAddSendReminder,
  NyAddSendReminder
} from '@/api/commonPage/dangerTreatment'
import { Toast } from 'vant'
export default {
  components: {
  },
  data() {
    return {
      formInline: {
        sendReminder: ''
      },
      apiMap: {
        安全生产: AqAddSendReminder,
        环保管理: HbAddSendReminder,
        消防管理: XfAddSendReminder,
        能源管理: NyAddSendReminder
      },
      loading: false
    }
  },
  computed: {

  },
  methods: {
    onSubmit(values) {
      this.loading = true
      this.apiMap[this.$route.query.current]({
        ...values,
        dangersLedgerId: this.$route.query.dangersLedgerId || this.$route.query.id
      }).then(res => {
        if (res.status === 0) {
          this.$emit('input', false)
          Toast.success(res.msg)
        }
        this.loading = false
      })
    }
  }
}
</script>
<style scoped lang="scss">
</style>
